
var camera,renderer,scene,isVr=false;
var  W = window.innerWidth;
var  H = window.innerHeight;


function init(){
	
	camera = new THREE.PerspectiveCamera(75,W/H,0.1,10000);
	
	scene = new THREE.Scene();
	
	renderer = new THREE.WebGLRenderer({antialias:true});
	renderer.setSize(W,H);
	$("#contant").append(renderer.domElement);
	renderer.setClearColor(0xffffff);
	
	window.addEventListener('resize', onResize, true);
	window.addEventListener('vrdisplaypresentchange', onResize, true);
	
}

function animate(){
	requestAnimationFrame(animate);
	if(isVr){
	   effect.render(scene, camera);
	}else{
	   renderer.render(scene,camera);
	}
	
}


function onResize(e) {
	camera.aspect = W / H;
	camera.updateProjectionMatrix();
	if (isVr) {
		effect.setSize(W,H);
	} else {
		renderer.setSize(W,H);
	}
}


//function creatElement(){
//	this.
//}


init();
animate();
